package com.ruoyi.consume.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.consume.mapper.GraftingclipApplyConMapper;
import com.ruoyi.consume.domain.GraftingclipApplyCon;
import com.ruoyi.consume.service.IGraftingclipApplyConService;

/**
 * 嫁接夹领用Service业务层处理
 *
 * @author ruoyi
 * @date 2021-07-23
 */
@Service
public class GraftingclipApplyConServiceImpl implements IGraftingclipApplyConService
{
    @Autowired
    private GraftingclipApplyConMapper graftingclipApplyConMapper;

    /**
     * 查询嫁接夹领用
     *
     * @param graftingclipApplyId 嫁接夹领用ID
     * @return 嫁接夹领用
     */
    @Override
    public GraftingclipApplyCon selectGraftingclipApplyById(Long graftingclipApplyId)
    {
        return graftingclipApplyConMapper.selectGraftingclipApplyById(graftingclipApplyId);
    }

    /**
     * 查询嫁接夹领用列表
     *
     * @param graftingclipApplyCon 嫁接夹领用
     * @return 嫁接夹领用
     */
    @Override
    public List<GraftingclipApplyCon> selectGraftingclipApplyList(GraftingclipApplyCon graftingclipApplyCon)
    {
        return graftingclipApplyConMapper.selectGraftingclipApplyList(graftingclipApplyCon);
    }

    /**
     * 新增嫁接夹领用
     *
     * @param graftingclipApplyCon 嫁接夹领用
     * @return 结果
     */
    @Override
    public int insertGraftingclipApply(GraftingclipApplyCon graftingclipApplyCon)
    {
        graftingclipApplyCon.setCreateTime(DateUtils.getNowDate());
        return graftingclipApplyConMapper.insertGraftingclipApply(graftingclipApplyCon);
    }

    /**
     * 修改嫁接夹领用
     *
     * @param graftingclipApplyCon 嫁接夹领用
     * @return 结果
     */
    @Override
    public int updateGraftingclipApply(GraftingclipApplyCon graftingclipApplyCon)
    {
        graftingclipApplyCon.setUpdateTime(DateUtils.getNowDate());
        return graftingclipApplyConMapper.updateGraftingclipApply(graftingclipApplyCon);
    }

    /**
     * 批量删除嫁接夹领用
     *
     * @param graftingclipApplyIds 需要删除的嫁接夹领用ID
     * @return 结果
     */
    @Override
    public int deleteGraftingclipApplyByIds(Long[] graftingclipApplyIds)
    {
        return graftingclipApplyConMapper.deleteGraftingclipApplyByIds(graftingclipApplyIds);
    }

    /**
     * 删除嫁接夹领用信息
     *
     * @param graftingclipApplyId 嫁接夹领用ID
     * @return 结果
     */
    @Override
    public int deleteGraftingclipApplyById(Long graftingclipApplyId)
    {
        return graftingclipApplyConMapper.deleteGraftingclipApplyById(graftingclipApplyId);
    }

    /**
     * 更新库存量表
     *
     * @param graftingclipApplyCon 嫁接夹领用ID
     * @return 结果
     */
    @Override
    public int updateGraftingclipAmount(GraftingclipApplyCon graftingclipApplyCon){
        return graftingclipApplyConMapper.updateGraftingclipAmount(graftingclipApplyCon);
    }

    /**
     * 更新领用状态
     *
     * @param graftingclipApplyId 嫁接夹领用ID
     * @return 结果
     */
    @Override
    public int updateConsumeStatus(Long graftingclipApplyId){
        return graftingclipApplyConMapper.updateConsumeStatus(graftingclipApplyId);
    }

    /**
     * 退回操作
     *
     * @param graftingclipApplyId 嫁接夹领用ID
     * @return 结果
     */
    @Override
    public int updateApprovalStatus(Long graftingclipApplyId){
        return graftingclipApplyConMapper.updateApprovalStatus(graftingclipApplyId);
    }
}
